package com.unitreport.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;

import com.unitreport.domain.UnitCmd;

public class ReadCmdUtil {
	
	public static List<UnitCmd> ReadCmdInScriptFile() {
		List<UnitCmd> list = new ArrayList<UnitCmd>();
		
		try {
			String ScriptFilePath = PropertiesUtil.getPropertiesValue("unitCmdFilePath");
			BufferedReader br = new BufferedReader(new FileReader(ScriptFilePath));
			String unitCmdStr = br.readLine();
			while (unitCmdStr != null) {
				UnitCmd unitCmd = new UnitCmd();
				unitCmd.setCmd(unitCmdStr);
				list.add(unitCmd);
				
				unitCmdStr = br.readLine();

			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return list;
		
	}
	
}
